<template>
  <div class="modify" :style="{height: height + 'px'}" @click="modifyClick" v-if="showModify">
    <div class="dialog" >
      <div class="dialog-body" >
        <slot></slot>
      </div>
      <div class="input">
          <input class="input1" type="text" value=""/>
      </div>
      <div class="dialog-footer">
        <div class="btn" @click.stop="cancelModify"><div style="margin-top: 3px;">取消</div></div>
        <div class="btn" @click.stop="dialogConfirmModify"><div style="margin-top: 3px;">确定</div></div>
      </div>
    </div>
  </div>
</template>
<script>
  export default {
    name: 'modifydialog',
    props: {
      showModify: {
        type: Boolean,
        default() {
          return false
        }
      },
      dialogHeight: {
        type: [Number,String],
        default() {
          return 75
        }
      },
      footerText: {
        type: String,
        default() {
          return '我知道了'
        }
      }
    },
    computed: {
      top(){
        return (window.innerHeight - this.dialogHeight) / 2
      }
    },
    data() {
      return {
        height: window.innerHeight,
        // left: window.innerWidth * 0.2 / 2
      }
    },
    methods:{
      modifyClick(){
        this.$emit('modifyClick')
      },
      cancelModify(){
        this.$emit('cancelModify')
      },
      dialogConfirmModify(){
        this.$emit('dialogConfirmModify')
      }
    }
  }
</script>
<style scoped>
  .modify{
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;  
  }
  .dialog{
    position: absolute;
    top: 6.25rem;
    width: 9rem;
    background-color: #f3f3f3;
    z-index: 1001;
    border-radius: 10px;
    left: 0.89rem;
    height: 4.95rem;
  }
  .dialog-body{
    font-size: 0.5rem;
    padding: 0.5rem 0.7rem 0.15rem 0.7rem;
    text-align: center;
    line-height: 0.95rem;
  }
  .input{
    padding-bottom: 0.45rem;
    height: 0.9rem;
    margin: 0 auto;
    text-align: center;
  }
  .input .input1{
    border:none;
    outline: none;
    width: 5rem;
    background: #28706c;
    border-radius: 1rem;
    height: 100%;
    font-size: 0.5rem;
    text-indent: 0.3rem;
    color: #fff;
    
  }
  .dialog-footer{
    
    padding: 10px 15px;
    display: flex;
    justify-content: space-around;
  }
  .dialog-footer .btn{
    width: 3.6rem;
    height: 1rem;
    border: 1px solid #444;
    text-align: center;
    border-radius:20px; 
    color:black
  }
</style>
